package com.hqyj.fj.javaSpringBoot.modules.account.controller;

import com.hqyj.fj.javaSpringBoot.modules.account.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class AccountController {

    @Autowired
   private UserService  userService;



    /*
     * 127.0.0.1:8081/login ---- get
     */

    @GetMapping("/login")
    public  String LoginPage(ModelMap modelMap){
        modelMap.put("template","account/login");
        return "indexSimple2";
    }

    /*
     * 127.0.0.1:8081/register ---- get
     */

    /*
     * 127.0.0.1:8081/logout ---- get
     */
    @GetMapping("/logout")
    public String logout() {
        userService.logout();
        return "redirect:/login";
    }

    @GetMapping("/register")
    public String registerPage(ModelMap modelMap) {
        modelMap.put("template", "account/register");
        return "indexSimple2";
    }

    /*
     * 127.0.0.1:8081/account/users ---- get
     */

    @GetMapping("/account/users")
    public  String userPage(){
        return  "index";
    }

    /*
     * 127.0.0.1:8081/account/roles ---- get
     */

    @GetMapping("/account/roles")
    public  String rolePage(){
        return  "index";
    }


    /*
     * 127.0.0.1:8081/account/resources ---- get
     */

    @GetMapping("/account/resources")
    public  String resourcePage(){
        return  "index";
    }

    /*
     * 127.0.0.1:8081/account/profile ---- get
     */
    @GetMapping("/account/profile")
    public String profilePage() {
        return "index";
    }

}

